#ifndef ADMIN_STUDENT_H
#define ADMIN_STUDENT_H

#include <QWidget>
#include <QSqlDatabase>
#include <QStandardItemModel>
#include "ui_add.h"
#include "ui_modify.h"
namespace Ui {
class admin_student;
}

class admin_student : public QWidget
{
    Q_OBJECT

public:
    explicit admin_student(QWidget *parent = nullptr);
    ~admin_student();

private slots:
    void on_pushButton_import_clicked();

    void on_pushButton_delete_clicked();
    void on_checkBox_all_toggled(bool checked); // 全选框切换的槽函数声明
    void updateAllCheckBoxState(); // 更新全选框状态的函数声明
    void on_pushButton_find_clicked();

    void on_pushButton_add_clicked();

    void on_pushButton_modify_clicked();
    void updateStudentInfo(const QString &studentId, const QString &name, const QString &gender,
                           const QString &contact, const QString &major, const QString &building,
                           const QString &room, const QString &startDate, const QString &endDate,
                           const QString &password);

private:
    Ui::admin_student *ui;
    QSqlDatabase db;
    QStandardItemModel m_model;
    bool isDatabaseConnected();
};

#endif // ADMIN_STUDENT_H
